package com.airplane.auto.service;



import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.airplane.auto.util.AlarmUtil;
import com.airplane.auto.util.ConfigCenter;
import com.airplane.auto.util.Constants;


public class BootCompletedReceiver extends BroadcastReceiver {
   
   public void onReceive(Context context, Intent intent) {
	   
	   Log.d("AutoAirplaneReboot", "AutoAirplane start alarm");
	   
	   String savedOpenTime = ConfigCenter.getValue(context, Constants.OPEN_TIME, "00:00");
	   String savedCloseTime = ConfigCenter.getValue(context, Constants.CLOSE_TIME, "07:00");
	   if(ConfigCenter.getValue(context, Constants.ENABLE_AUTO_CHANGE, true)){	
   			AlarmUtil.runAlarm(context, savedOpenTime, true);
   			AlarmUtil.runAlarm(context, savedCloseTime, false);
   		}
	   
   }

}